﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Betop.Lib.Common;

namespace Betop.Lib.Core.Module
{
    public partial class ModuleInfo
    {
        private string _navUrlAbsPath;
        public string NavUrlAbsPath
        {
            get
            {
                if (_navUrlAbsPath == null)
                {
                    if (string.IsNullOrEmpty(this.NavUrl) || this.NavUrl == "#")
                    {
                        _navUrlAbsPath = this.NavUrl;
                    }
                    else
                    {
                        _navUrlAbsPath = GlobalVar.WebAppPath + this.NavUrl;
                    }
                }
                return _navUrlAbsPath;
            }
        }

        private string _iconUrlAbsPath;
        public string IconUrlAbsPath
        {
            get
            {
                if (_iconUrlAbsPath == null)
                {
                    if (string.IsNullOrEmpty(this.IconUrl))
                    {
                        _iconUrlAbsPath = this.IconUrl;
                    }
                    else
                    {
                        _iconUrlAbsPath = GlobalVar.WebAppPath + this.IconUrl;
                    }
                }
                return _iconUrlAbsPath;
            }
        }

        private ModuleInfo _upperModuleInfo;
        public Func<int, ModuleInfo> GetUpperModuleInfo;
        public ModuleInfo UpperModuleInfo
        {
            get
            {
                if (_upperModuleInfo == null)
                {
                    _upperModuleInfo = GetUpperModuleInfo(this.UpperID);

                }
                return _upperModuleInfo;
            }
        }

        private List<ModuleInfo> _subModuleInfos;
        public Func<int,List<ModuleInfo>> GetSubModuleInfos;
        public List<ModuleInfo> SubModuleInfos
        {
            get
            {
                if (_subModuleInfos == null)
                {
                    _subModuleInfos = GetSubModuleInfos(this.ID);
                }
                return _subModuleInfos;
            }
        }




    }
}
